library( here )
## here() starts at /data/share/cdi/MLIV/Local repos/ppolskaia/MLIV
# Source function to generate file paths
source( here::here( "R/configs.R" ) )
# Load packages
source( here::here( "R/packages.R" ) )
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
## randomForest 4.7-1.1
## Type rfNews() to see new features/changes/bug fixes.
##
## Attaching package: 'randomForest'
## The following object is masked from 'package:dplyr':
##
## combine
## The following object is masked from 'package:ggplot2':
##
## margin
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## Loading required package: lme4
##
## arm (Version 1.12-2, built: 2021-10-15)
## Working directory is /data/share/cdi/MLIV/Local repos/ppolskaia/MLIV/tests
## Find out more at https://www.synthpop.org.uk/
## Loaded glmnet 4.1-4
## Loading required package: lattice
##
## Attaching package: 'caret'
## The following object is masked from 'package:purrr':
##
## lift
## Loading required package: roperators
##
## Attaching package: 'roperators'
## The following object is masked from 'package:tibble':
##
## num
## The following object is masked from 'package:ggplot2':
##
## %+%
## ##
## ## Rforestry (Version 0.9.0.95, Build Date: R 4.2.0; x86_64-pc-linux-gnu; 2023-04-06 20:18:33 UTC; unix)
## ## See https://github.com/forestry-labs for additional documentation.
## ## Please cite software as:
## ## Soren R. Kunzel, Theo F. Saarinen, Edward W. Liu, Jasjeet S. Sekhon. 2019.
## ## ''Linear Aggregation in Tree-based Estimators.'' arXiv preprint
## ## arXiv:1906.06463. https://arxiv.org/abs/1906.06463
## ##
## Registered S3 method overwritten by 'crs':
## method from
## predict.gsl.bs np
## Loading required package: nlme
##
## Attaching package: 'nlme'
## The following object is masked from 'package:lme4':
##
## lmList
## The following object is masked from 'package:dplyr':
##
## collapse
## Loading required package: nnet
## Loading required package: survival
##
## Attaching package: 'survival'
## The following object is masked from 'package:caret':
##
## cluster
##
## Attaching package: 'formattable'
## The following object is masked from 'package:MASS':
##
## area
##
## Attaching package: 'plotly'
## The following object is masked from 'package:formattable':
##
## style
## The following object is masked from 'package:MASS':
##
## select
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
##
## smiths
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:arm':
##
## logit
## The following object is masked from 'package:dplyr':
##
## recode
## The following object is masked from 'package:purrr':
##
## some
## Loading required package: foreach
##
## Attaching package: 'foreach'
## The following objects are masked from 'package:purrr':
##
## accumulate, when
## Loading required package: iterators
## Loading required package: parallel
# Load helper functions
source( here::here( "R/functions.R" ) )
load("/data/share/cdi/MLIV/Data/Simulated/Sim_Run_2024-01-08_ca/ca_50_1_CDML.RData")
df = ca_50_1_CDML
cdml = df %>%
select(metric, id, CDML, queen)
# Turn off scientific notation
options( scipen = 999 )
# Filter the dataframe to include only rows where metric is "bias"
cdml_bias <- cdml %>%
filter(metric == "bias")
cdml_bias_queen <- cdml_bias %>%
filter(queen == "RF MOM DR")
# Create the ggplot object
p <- ggplot(cdml_bias_queen, aes(x = id, y = CDML)) +
geom_bar(stat = "identity") +
labs(x = "ID", y = "CDML Value", title = "Histogram of CDML for Bias Metric Faceted by Queen") +
theme_minimal()
# Convert ggplot object to plotly object
ggplotly(p)